local SceneBase = require("app.Base.SceneBase")

local CreatMapScene = class("LoadingScene", SceneBase)

function CreatMapScene:ctor()
    CreatMapScene.super.ctor(self,data)
    print("CreatMapScene:ctor")
    self.btns = {}

    self:initUI()

    self:AddButtonEvents()
end

function CreatMapScene:initUI()
    CreatMapScene.super.initUI(self)    

    self.title_text = td.CreateLabel("地图编辑器",nil,"48")
    td.AddRelaPos(self.bg,self.title_text,cc.p(0.5,0.9))

    self.creatMapBtn = td.CreateBtn({text = "新建地图"})
    td.AddRelaPos(self.bg,self.creatMapBtn,cc.p(0.5,0.7))

    self.editMapBtn = td.CreateBtn({text = "编辑地图"})
    td.AddRelaPos(self.bg,self.editMapBtn,cc.p(0.5,0.5))

    self.runMapBtn = td.CreateBtn({text = "模拟运行"})
    td.AddRelaPos(self.bg,self.runMapBtn,cc.p(0.5,0.3))


end

function CreatMapScene:AddButtonEvents()
    td.BtnAddTouch(self.creatMapBtn,handler(self,self.CreatMap))
    td.BtnAddTouch(self.editMapBtn,handler(self,self.EditMap))
    td.BtnAddTouch(self.runMapBtn,handler(self,self.RunMap))
end

function CreatMapScene:CreatMap()
    print("CreatMapScene:CreatMap")
    local SetCreatNewMapLayer = require("app.layer.SetCreatNewMapLayer").new()
    SetCreatNewMapLayer:addTo(self)
end

function CreatMapScene:EditMap()
    print("CreatMapScene:EditMap")
end

function CreatMapScene:RunMap()
    print("CreatMapScene:RunMap")
end

function CreatMapScene:Update(dt)
--    print("CreatMapScene:Update："..dt)
end

return CreatMapScene